package com.ab.demo.configs;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: abdul
 * @Date: 2018/11/15 22:26
 * @Description:
 */

@Configuration
public class Config {
    @Bean
    public DruidDataSource dataSource() {
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        druidDataSource.setUrl("jdbc:mysql://127.0.0.1:3306/work?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("qwe123!@#");
        druidDataSource.setInitialSize(8);
        druidDataSource.setMinIdle(8);
        druidDataSource.setMaxActive(2);
        return druidDataSource;
    }
}
